<% content_for :css do %>
  <%= stylesheet_link_tag 'tools_flashs_show' %>
<% end %>
<% content_for :javascript do %>
  <script type="text/javascript" charset="utf-8">
    function autoResize() {
      $$('embed.flash_portalet').each(function (flash) {    
        flash.setStyle({
          height: getFlashPortaletHeight() + 'px',
          width:'800px' 
        });
      });
      $$('object.flash_portalet').each(function (flash) {    
        flash.setStyle({
          height: getFlashPortaletHeight() + 'px',
          width:'800px' 
        });
      });
    }
    
    function getFlashPortaletHeight() {
      return (document.viewport.getHeight() - $('flash_name').getHeight() - 20) ;
    }
  </script>
<% end %>
<div id='flash'>
  <div id='flash_name' class='name'>
    <%= @tool.name %><span>-<%= @tool.key_words %></span>
    <%= link_to_function "看看怎么玩", "Effect.ScrollTo('introduce',{during:3});" %>
    <% if has_logined_by_user? %>    
    <%= link_to_remote('收藏到我的拼盘中',
          :url => add_flash_to_my_dish_tools_flashs_url(:tool_id => @tool.id),
          :method => :post,
          :complete => "$('add_flash_to_my_dish').hide();$('added_to_my_dish').show()",
          :html => {
            :id => 'add_flash_to_my_dish',
            :style => @tool.set_by_current_user? ? 'display:none' : ''
          }
        )  %>
    <%= link_to('已经收藏到我的拼盘中了',
          user_url(current_user),
          :target => :_blank,
          :id => 'added_to_my_dish',
          :style => @tool.set_by_current_user? ? '' : 'display:none'
        )  %>
    <% else %>
    <%= link_to '收藏到我的拼盘中',
          new_session_url,
          :id => 'add_flash_to_my_dish'
     %>
    <% end %>
  </div>
  <div id='flash_body' class='body'>
  <%= @tool.flash_embed %>
  </div>
  <div id='introduce' class='introduce'>
    <%= @tool.introduce %>
  </div>
  <div class='done'>
    <%= link_to_function "看完了，开始游戏", "Effect.ScrollTo('flash',{during:3});" %>
  </div>
</div>
<script type="text/javascript" charset="utf-8">
  autoResize();
  Effect.ScrollTo('flash',{during:3});
</script>


